//HolidayModel
//2021-01-21 18:16:41

package models

import(
    "git.900sui.cn/kc/base/common/functions"
    "git.900sui.cn/kc/base/common/models/base"
    "git.900sui.cn/kc/kcgin/orm"
	)

//表结构体
type HolidayModel struct {
	Model *base.Model
	Field HolidayModelField
}

//表字段
type HolidayModelField struct{
	T_table	string	`default:"holiday"`
	F_id	string	`default:"id"`
	F_year	string	`default:"year"`
	F_date_ymd	string	`default:"date_ymd"`
}

//初始化
func (h *HolidayModel) Init(ormer ...orm.Ormer) *HolidayModel{
	functions.ReflectModel(&h.Field)
	h.Model = base.NewModel(h.Field.T_table, ormer...)
	return h
}

//新增数据
func (h *HolidayModel) Insert(data map[string]interface{}) (int){
	result,_ := h.Model.Data(data).Insert()
	return result
}

//获取单条数据
func (h *HolidayModel) GetByDateYmd(dateYmd int)(reply map[string]interface{}){
	reply  = make(map[string]interface{})
	//分析参数
	if dateYmd <=0{
		return
	}
	reply = h.Model.Where([]base.WhereItem{
		{h.Field.F_date_ymd,dateYmd},
	}).Find()
	return
}